package org.example.demo3.demos.web.VmsTransactionFlowInvoice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.demo3.demos.web.VmsTransactionFlowInvoice.domain.*;
import org.example.demo3.demos.web.model.negativestream.vmstransactionflowinvoice.VmsTransacitonFlowInvoiceItemVo;

import java.util.List;

@Mapper
public interface VmsTransactionFlowInvoiceMapper extends BaseMapper<NvatTrandtadvaltaxsep> {
//               group by的地方     必须这俩参数一模一样,就会合并为一条数据. 不然就不会合并. (如果所有数据都是独立的,那就是无效的)
//
//     t1.CFHBZT = '1' 拆分合并状态 1没拆分合并 2拆分 3合并
//     and t1.LSXZ ='1' 流水性质 1蓝字发票(正常) 2.红字 3.反向蓝字 4.折扣 5.冲正 6. 撤销
//
     IPage<VmsTransactionFlowInvoicePageVo> getTransactionFlowInvoiceList(@Param("page") Page<NvatTrandtadvaltaxsep> page,@Param("deptCode") String deptCode,@Param("dto") VmsTransactionFlowInvoicePageDto dto);
     @Select("    SELECT *  FROM NVAT_TRANDTADVALTAXSEP T1;")
     List<VmsTransactionFlowInvoicePageVo> getList();
     IPage<VmsMergeQueryVo>  mergePageQuery(@Param("page") IPage page,@Param("ywbh") String ywbh ,@Param("tbdh") String tbdh ,@Param("deptCode") String deptCode );
     List<NvatTrandtadvaltaxsep> mergeQuery(@Param("ywbh") String ywhh ,@Param("tbdh") String tbdh ,@Param("deptCode") String getDeptCode,@Param("rdids")  List<String> rdids );

     VmsFlowInvoiceDetailVo restoreSplit (@Param("id") String id);
     VmsFlowInvoiceDetailVo getMergeInfo (@Param("id") String id);
     VmsFlowInvoiceDetailVo getSplitInfo (@Param("id") String id);

     IPage<VmsFlowInvoiceDetailVo> getSplitItem (@Param("page") IPage<VmsFlowInvoiceDetailVo> page,@Param("id") String id);
     IPage<VmsFlowInvoiceDetailVo> getMergeItem (@Param("page") IPage<VmsFlowInvoiceDetailVo> page,@Param("id") String id);





     List<VmsFlowInvoiceDetailVo> getSplitItemList (@Param("rdid") String rdid);
     List<VmsFlowInvoiceDetailVo> getMergeItemList (@Param("rdid") String rdid);

     Long verifySplit(@Param("id") Long id);
     Long verifyMerge(@Param("id") Long id);
     Long checkPolicyNumber(@Param("ids") List<Long> ids);
     List<VmsTransacitonFlowInvoiceItemVo> selectInvoiceByIds(@Param("ids") List<Long> ids);
}
